//
//  SVExploreViewController.m
//  SilenceVoice
//
//  Created by 张诗宇 on 16/1/27.
//  Copyright © 2016年 张诗宇. All rights reserved.
//

#import "SVExploreViewController.h"
#import "SVExploreModel.h"
#import "SVMPBackground.h"

@interface SVExploreViewController ()

@property (nonatomic, strong) NSMutableArray *allArray;

@end

@implementation SVExploreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor yellowColor];
    self.allArray = [NSMutableArray array];
    
    [self getDataFromUrl:@"http://echosystem.kibey.com/event/list?page=1&type=0&limit=10"];
    
    SVMPBackground *testView = [[SVMPBackground alloc] initWithFrame:self.view.frame];
    [self.view addSubview:testView];
    
    
}

- (void)getDataFromUrl:(NSString *)url {
    NSString *cookie = @"PHPSESSID=g5v57c711o1icbf9t1eciu6k85";
    NSString *user_Agent = @"echo ios 1.0 20151114;(iPhone,iPhone OS7.1.1);IDFA B6F8674A-04C4-445C-95A0-0C7BE992ACF2";
    [SVAppTools creatingDataTask:url parameters:nil Cookie:cookie User_Agent:user_Agent successAFNBlock:^(id responseObject) {
        NSArray *result = [responseObject objectForKey:@"result"];
        for (NSDictionary *dic in result) {
            SVExploreModel *model = [[SVExploreModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.allArray addObject:model];
        }
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
